<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- meta -->
    <meta charset="utf-8"/>
    <meta name='description' content='<%= config.description %>'>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="keywords" content="<%= config.keywords %>"/>
    <!-- see http://smerity.com/articles/2013/where_did_all_the_http_referrers_go.html -->
    <meta name="referrer" content="always">

    <%
    var headers = config.site_headers || [];
    for (var i = 0, l = headers.length; i < l; i++) {
    %>
    <%- headers[i] %>
    <% } %>

    <link title="RSS" type="application/rss+xml" rel="alternate" href="/rss"/>

    <% if (config.site_icon) { %>
    <link rel="icon" href="<%- staticFile(config.site_icon) %>" type="image/x-icon"/>
    <% } %>

    <!-- style -->
    <%- Loader('/public/stylesheets/index.min.css')
    .css('/public/libs/bootstrap3/css/bootstrap.css')
    .css('/public/stylesheets/common.css')
    .css('/public/stylesheets/style.less')
    .css('/public/stylesheets/responsive.css')
    .css('/public/stylesheets/jquery.atwho.css')
    .css('/public/libs/editor/editor.css')
    .css('/public/libs/webuploader/webuploader.css')
    .css('/public/libs/code-prettify/prettify.css')
    .css('/public/libs/font-awesome/css/font-awesome.css')
    .css('/public/stylesheets/thumbnail.less')
    .done(assets, config.site_static_host, config.mini_assets)
    %>

    <!-- scripts -->
    <%- Loader('/public/index.min.js')
    .js('/public/libs/jquery-2.1.0.js')
    .js('/public/libs/lodash.min.js')
    .js('/public/libs/jquery-ujs.js')
    .js('/public/libs/bootstrap3/js/bootstrap.js')
    .js('/public/libs/jquery.caret.js')
    .js('/public/libs/jquery.atwho.js')
    .js('/public/libs/jquery.lazyloadxt.js')
    .js('/public/libs/jquery.nicescroll.js')
    .js('/public/libs/jquery.tmpl.min.js')
    .js('/public/libs/markdownit.js')
    .js('/public/libs/code-prettify/prettify.js')
    .js('/public/libs/qrcode.js')
    .js('/public/javascripts/main.js')
    .js('/public/javascripts/responsive.js')
    .done(assets, config.site_static_host, config.mini_assets)
    %>

    <% if (typeof(topic) !== 'undefined') { %>
    <title><%= topic.title %> - <%= config.name %></title>
    <% } else if (typeof(pageTitle) !== 'undefined') { %>
    <title><%= pageTitle %> - <%= config.name %></title>
    <% } else { %>
    <title><%= config.description %></title>
    <% } %>
    <meta content="_csrf" name="csrf-param">
    <meta content="<%= csrf %>" name="csrf-token">
</head>
<body>
<!-- navbar -->
<div class='navbar'>
    <div class='navbar-inner'>
        <div class='container'>
            <a class='navbar-brand' href='/'>
                <% if (config.site_logo) {%>
                <img src="<%- staticFile(config.site_logo) %>"/>
                <%} else {%>
                <%- config.name %>
                <%}%>
            </a>

            <form id='search_form' class='navbar-search' action="/search">
                <input type='text' id='q' name='q' class='search-query col-md-3' value=''/>
            </form>
            <ul class='navbar-nav pull-right'>
                <li><a href='/'>首页</a></li>
                <% if (current_user){ %>
                <li>
                    <a href='/my/messages'>
                        <% if (current_user.messages_count) { %>
                        <span class='big messages_count'><%= current_user.messages_count %></span>
                        <% } %>
                        未读消息
                    </a>
                </li>
                <% } %>
                <%
                var site_navs = config.site_navs || [];
                for (var i = 0, l = site_navs.length; i < l; i++) {
                var nav = site_navs[i];
                %>
                <li><a href="<%- nav[0] %>" target="<%- nav[2] %>"><%- nav[1] %></a></li>
                <% } %>

                <% if (current_user) { %>
                <li><a href='/setting'>设置</a></li>
                    <% if (current_user.is_admin) { %>
                    <li><a href='/admin/dashboard'>管理</a></li>
                    <% } %>
                <li>
                    <a href="####" onclick="signout();return false;" id="signout_button" rel="nofollow">退出</a>
                </li>
                <% } else { %>
                <li><a href='/signup'>注册</a></li>
                <li><a href='/signin'>登录</a></li>
                <% } %>
            </ul>
            <a class="btn btn-navbar" id="responsive-sidebar-trigger">
                <span class="glyphicon-bar"></span>
                <span class="glyphicon-bar"></span>
                <span class="glyphicon-bar"></span>
            </a>
        </div>
    </div>
</div>
<div id='main'>
    <%- body %>
</div>
<div id='backtotop'>回到顶部</div>
<!--<div id='footer'>-->
<!--<div id='footer_main'>-->
<!--<div class="links">-->
<!--<a class='dark' href='/rss'>RSS</a>-->
<!--|-->
<!--<a class='dark' href='https://github.com/cnodejs/nodeclub/'>源码地址</a>-->
<!--</div>-->

<!--<%- partial('./_sponsors') %>-->

<!--</div>-->
<!--</div>-->
<div id="sidebar-mask"></div>
<!-- 用户登录的modal层-->
<div class="modal fade" id="signin_modal" role="dialog" aria-hidden="true" aria-labelledby="signinModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <!--<form id='signin_form' action='/signin' method='post'>-->
                <div class="modal-header">
                    <h5 class="modal-title">登录</h5>
                </div>
                <div class="modal-body">

                        <div class='form-group'>
                            <label class='control-label' for='signin_modal_name'>用户名</label>

                            <div class='controls'>
                                <input class='form-control' id='signin_modal_name' name='name' size='30' type='text'/>
                            </div>
                        </div>
                        <div class='form-group'>
                            <label class='control-label' for='signin_modal_pass'>密码</label>

                            <div class='controls'>
                                <input class='form-control' id='signin_modal_pass' name='pass' size='30' type='password'/>
                            </div>
                        </div>
                        <input type='hidden' name='_csrf' value='<%= csrf %>'/>

                </div>
                <div class="modal-footer">
                    <a id="forgot_password" href='/search_pass' class="pull-left">忘记密码了?</a>
                    <button type="button" id="signin-modal-close" class="btn " data-dismiss="modal">Close</button>
                    <a href="/auth/github" class='btn'>GitHub登录</a>
                    <button id="signin_modal_button" class='btn'>登录</button>
                </div>
            <!--</form>-->
        </div>
    </div>
</div>
<%- partial('./_tongji') %>


</body>
</html>
